package icu.feigroup.domain.activity.service.discount.impl;

import icu.feigroup.domain.activity.model.valobj.GroupActivityDiscountVO;
import icu.feigroup.domain.activity.service.discount.AbstractDiscountCalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * projectName:icu.feigroup.domain.activity.service.discount.impl
 *
 * @author 飞
 * @since 2025/2/20 10:34
 * description:N元购
 */
@Slf4j
@Service("N")
public class NDiscountCalculate extends AbstractDiscountCalculateService {
    @Override
    protected BigDecimal doCalculate(BigDecimal originPrice, GroupActivityDiscountVO.GroupDiscount groupDiscount) {
        String marketExpr = groupDiscount.getMarketExpr();
        BigDecimal deduction = new BigDecimal(marketExpr);
        return compareZero(deduction);
//        return originPrice.compareTo(deduction)<=0? originPrice : deduction;
    }
}
